<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>方法相关</title>


</head>
<body>
<!--通过按钮的事件调用方法-->
<input type="button" value="按钮" onclick="fn1()">



<script>
    //单行注释 Ctrl /
    /*多行注释*/
    //无参无返回值
    function fn1(){
        alert("fn1")
    }
    //调用
    //fn1();
    //有参无返回值
    function fn2(name,age) {
        alert(name+":"+age+"岁")
    }
    //fn2("张飞",18)
    function fn3(){
        return "我是返回值"
    }
    // let info = fn3();
    // alert(info);

    // function fn4(){
    //     return 3114;
    // }
    // let i = fn4();
    // alert(i);
    //有参有返回值
    function fn4(x,y){
        return x*y;
    }
    let result = fn4(9,9);
    // alert(result);
    //第二种声明方式
    let fn5 = function(name,age){
        alert(name+":"+age+"岁了")
    }
    // fn5("刘备",50)
    //第三种声明方式
    let fn6 = new Function("name","age","alert(name+':'+age+'岁了')");
    fn6("赵云",80)


</script>

</body>
</html>